<%@ Control Language="C#" AutoEventWireup="true" CodeFile="registerform.ascx.cs" Inherits="forums_controls_registration_registerform" %>
<asp:Panel runat="server" ID="pnlRegister" Width="100%" DefaultButton="btnLogin">
    <asp:MultiView runat="server" ID="mviewRegister" ActiveViewIndex="0">
        <asp:View runat="server" ID="viewAnonymous">
            <table width="100%">
                <tr>
                    <td width="50%">
                        <p>
                            Register for a new account:
                        </p>
                        <p>
                            Username: <asp:TextBox runat="server" ID="txtUsername" MaxLength="25" />
                            <asp:RequiredFieldValidator ID="valUsernameRequired" runat="server" ErrorMessage="You forgot your username, idiot." ControlToValidate="txtUsername" EnableClientScript="False" ValidationGroup="Registration" Display="None"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="valUsernameLength" runat="server" ControlToValidate="txtUsername"
                                EnableClientScript="False" ErrorMessage="Your username must be between 1 and 25 characters long."
                                ValidationExpression="^.{1,25}$" ValidationGroup="Registration" Display="None"></asp:RegularExpressionValidator>
                            <asp:CustomValidator ID="valUsernameUnique" runat="server" ControlToValidate="txtUsername"
                                EnableClientScript="False" ErrorMessage="Someone has already registered '[username] '"
                                OnServerValidate="valUsernameUnique_ServerValidate" ValidationGroup="Registration" Display="None"></asp:CustomValidator></p>
                        <p>
                            Password: <asp:TextBox runat="server" ID="txtPassword"
                                         TextMode="password" />
                            <asp:RequiredFieldValidator ID="valPasswordRequired" runat="server" ControlToValidate="txtPassword"
                                EnableClientScript="False" ErrorMessage="You forgot to give yourself a password."
                                ValidationGroup="Registration" Display="None"></asp:RequiredFieldValidator></p>
                        <p>
                            Turing Test: What's the sound a cat makes (hint: it's 4 letters long and rhymes with "cow"):<br />
                            <asp:TextBox runat="server" ID="txtTuringTest" />
                            <asp:RequiredFieldValidator ID="valTuringRequired" runat="server" ControlToValidate="txtTuringTest"
                                EnableClientScript="False" ErrorMessage="You can't sign up without passing the turing test."
                                ValidationGroup="Registration" Display="None"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="valTuringRegex" runat="server" ControlToValidate="txtTuringTest"
                                EnableClientScript="False" ErrorMessage="Don't you know what sound a cat makes?"
                                ValidationExpression="meow" ValidationGroup="Registration" Display="None"></asp:RegularExpressionValidator></p>
                        <p>
                            <asp:Button runat="server" ID="btnLogin"
                                Text="Register" ValidationGroup="Registration" OnClick="btnLogin_Click" />
                        </p>
                    </td>
                    <td width="50%">
                        <asp:ValidationSummary ID="valSummary" runat="server" EnableClientScript="False"
                            HeaderText="Oh noes!" ValidationGroup="Registration" />
                        </td>
                </tr>
            </table>
        </asp:View>
        <asp:View runat="server" ID="viewAuthenticated">
            <p>
                W00t! You have a new FSTDT.com account.
            </p>
            <p>
                Please enjoy the <asp:Hyperlink runat="server" ID="lnkHome" Text="FSTDT Forums" NavigateUrl="~/forums/default.aspx" />
            </p>
        </asp:View>
        <asp:View ID="viewError" runat="server">
            You already have an account on FSTDT.com.</asp:View>
    </asp:MultiView></asp:Panel>